//
//  RootViewController.h
//  TabPilotEdit
//
//  Created by Scott Guyer on 7/19/08.
//  Copyright __MyCompanyName__ 2008. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol EVELoginContainer

- (void) setUserId:(NSString*)uid ;
- (void) setApiKey:(NSString*)apiKey ;

@end

typedef enum editpilotmode_ {
	EditPilotViewModeAdding,
	EditPilotViewModeEditing
} EditPilotViewMode;

@class PilotPickerViewController;
@class BrowserViewController;

@interface EditPilotViewController : UITableViewController < EVELoginContainer, UIAlertViewDelegate >
{
	
	IBOutlet UITableViewCell*      userIDCell;
	IBOutlet UITableViewCell*      apiKeyCell;
	IBOutlet UITableViewCell*      pilotCell;
	IBOutlet UITableViewCell*      addAllCell;
	IBOutlet UITableViewCell*      lookupCell;
	IBOutlet UITableViewCell*      testCell;
	
	IBOutlet UISwitch*             addAllSwitch;
	IBOutlet UITextField*          pilotText;
	IBOutlet UITextField*          userIDText;
	IBOutlet UITextField*          apiKeyText;
	IBOutlet UIActivityIndicatorView* testActivity;
		
	UITextField*                   activeResponder;
	PilotPickerViewController*     pilotPickerVC;
	BrowserViewController*         browserVC;
	EVEApi*                        charListRequest;
	NSMutableDictionary*           charList;
	Boolean                        doingLookup;
	Boolean                        pickingPilot;
	Boolean                        dataIsValid;	
	
	EditPilotViewMode              mode;
}

@property(nonatomic,retain) UITableViewCell*   userIDCell;
@property(nonatomic,retain) UITableViewCell*   apiKeyCell;
@property(nonatomic,retain) UITableViewCell*   pilotCell;
@property(nonatomic,retain) UITableViewCell*   addAllCell;
@property(nonatomic,retain) UITableViewCell*   lookupCell;
@property(nonatomic,retain) UITableViewCell*   testCell;
@property(nonatomic,retain) UIActivityIndicatorView* testActivity;
@property(nonatomic,retain) UISwitch*          addAllSwitch;
@property(nonatomic,retain) UITextField*   userIDText;
@property(nonatomic,retain) UITextField*   pilotText;
@property(nonatomic,retain) UITextField*   apiKeyText;
@property(assign,nonatomic) Boolean        dataIsValid;
@property(nonatomic,retain) NSMutableDictionary* charList;
@property(assign,nonatomic) EditPilotViewMode  mode;

- (IBAction) endOnExit:(id)sender ;
- (IBAction) editDidEnd:(id)sender ;
- (IBAction) apiLookup:(id)sender ;
- (IBAction) switchValueChanged:(id) sender ;
- (IBAction) saveAction:(id)sender ;

- (Boolean) loadCharacters ;

- (void) setDataValid:(BOOL)flag ;

- (void) setUserId:(NSString*)uid ;
- (void) setApiKey:(NSString*)apiKey ;

@end
